package ${packagePrefix}.domain.model.${tableName?lower_case}.valueobject;

import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.ToString;

import java.util.Objects;

/**
 * ${entityComment}值对象
 * 值对象特点：
 * 1. 不可变性
 * 2. 没有唯一标识
 * 3. 通过所有属性值判断相等性
 */
@Getter
@ToString
@AllArgsConstructor(access = AccessLevel.PRIVATE)
public final class ${domainObjectName}Status {
    
    /**
     * 状态码
     */
    private final String code;
    
    /**
     * 状态名称
     */
    private final String name;
    
    /**
     * 状态描述
     */
    private final String description;
    
    // 预定义状态值对象实例
    public static final ${domainObjectName}Status ACTIVE = new ${domainObjectName}Status("ACTIVE", "活跃", "实体处于活跃状态");
    public static final ${domainObjectName}Status INACTIVE = new ${domainObjectName}Status("INACTIVE", "不活跃", "实体处于不活跃状态");
    public static final ${domainObjectName}Status DELETED = new ${domainObjectName}Status("DELETED", "已删除", "实体已被逻辑删除");
    
    /**
     * 根据状态码获取状态对象
     *
     * @param code 状态码
     * @return 状态对象
     */
    public static ${domainObjectName}Status of(String code) {
        if ("ACTIVE".equals(code)) return ACTIVE;
        if ("INACTIVE".equals(code)) return INACTIVE;
        if ("DELETED".equals(code)) return DELETED;
        throw new IllegalArgumentException("Unknown status code: " + code);
    }
    
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ${domainObjectName}Status that = (${domainObjectName}Status) o;
        return Objects.equals(code, that.code);
    }
    
    @Override
    public int hashCode() {
        return Objects.hash(code);
    }
} 